[IA64] memmap: add IA64_DOM0VP_fpswa_revision hypercall
authorAlex Williamson <alex.williamson@hp.com>
Mon, 21 May 2007 16:09:33 +0000 (10:09 -0600)
committerAlex Williamson <alex.williamson@hp.com>
Mon, 21 May 2007 16:09:33 +0000 (10:09 -0600)
For ia64 domain builder memmap support

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
linux-2.6-xen-sparse/arch/ia64/xen/xcom_hcall.c
linux-2.6-xen-sparse/arch/ia64/xen/xcom_mini.c
linux-2.6-xen-sparse/arch/ia64/xen/xcom_privcmd.c
linux-2.6-xen-sparse/include/asm-ia64/hypercall.h
xen/arch/ia64/xen/dom0_ops.c
xen/include/public/arch-ia64.h

index 4c90b5b01e5f70fdac6d3f72a6ee6c32d698f4fa..694744fc0cbad25c6df5dbcb02c8fec48dc4c6e9 100644 (file)
@@ -395,3 +395,10 @@ xencomm_hypercall_vcpu_op(int cmd, int cpu, void *arg)
        return xencomm_arch_hypercall_vcpu_op(cmd, cpu,
                                              xencomm_create_inline(arg));
 }
+
+int
+xencomm_hypercall_fpswa_revision(unsigned int *revision)
+{
+       return xencomm_arch_hypercall_fpswa_revision(
+               xencomm_create_inline(revision));
+}
index 3c0baff1f0479986e366d46aa6bde01c13137b0e..b905c97f20bc90a95ab1cd598e2ac72e563823a1 100644 (file)
@@ -467,3 +467,19 @@ xencomm_mini_hypercall_sched_op(int cmd, void *arg)
        return xencomm_arch_hypercall_sched_op(cmd, desc);
 }
 EXPORT_SYMBOL_GPL(xencomm_mini_hypercall_sched_op);
+
+int
+xencomm_mini_hypercall_fpswa_revision(unsigned int *revision)
+{
+       int nbr_area = 2;
+       struct xencomm_mini xc_area[2];
+       struct xencomm_handle *desc;
+       int rc;
+
+       rc = xencomm_create_mini(xc_area, &nbr_area,
+                                revision, sizeof(*revision), &desc);
+       if (rc)
+               return rc;
+       return xencomm_arch_hypercall_fpswa_revision(desc);
+}
+EXPORT_SYMBOL_GPL(xencomm_mini_hypercall_fpswa_revision);
index 7c67373ccc52271c8725fdab291d7a6d1580dbd1..2e92b54917a8813c3b134683f196c7735a72bf25 100644 (file)
@@ -643,6 +643,38 @@ xencomm_privcmd_sched_op(privcmd_hypercall_t *hypercall)
        return ret;
 }
 
+static int
+xencomm_privcmd_ia64_dom0vp_op(privcmd_hypercall_t *hypercall)
+{
+       int cmd = hypercall->arg[0];
+       int ret;
+       
+       switch (cmd) {
+       case IA64_DOM0VP_fpswa_revision: {
+               unsigned int revision;
+               unsigned int __user *revision_user =
+                       (unsigned int* __user)hypercall->arg[1];
+               struct xencomm_handle *desc;
+               ret = xencomm_create(&revision, sizeof(revision),
+                                    &desc, GFP_KERNEL);
+               if (ret)
+                       break;
+               ret = xencomm_arch_hypercall_fpswa_revision(desc);
+               xencomm_free(desc);
+               if (ret)
+                       break;
+               if (copy_to_user(revision_user, &revision, sizeof(revision)))
+                       ret = -EFAULT;
+               break;
+       }
+       default:
+               printk("%s: unknown IA64 DOM0VP op %d\n", __func__, cmd);
+               ret = -EINVAL;
+               break;
+       }
+       return ret;
+}
+
 int
 privcmd_hypercall(privcmd_hypercall_t *hypercall)
 {
@@ -665,6 +697,8 @@ privcmd_hypercall(privcmd_hypercall_t *hypercall)
                return xencomm_privcmd_hvm_op(hypercall);
        case __HYPERVISOR_sched_op:
                return xencomm_privcmd_sched_op(hypercall);
+       case __HYPERVISOR_ia64_dom0vp_op:
+               return xencomm_privcmd_ia64_dom0vp_op(hypercall);
        default:
                printk("%s: unknown hcall (%ld)\n", __func__, hypercall->op);
                return -ENOSYS;
index b8f393a8c89cb5c30713a075d265f33d717cb55d..e4e31a8832018dd1645082ba7f102df356eff7d5 100644 (file)
@@ -382,6 +382,13 @@ xencomm_arch_hypercall_perfmon_op(unsigned long cmd,
                           IA64_DOM0VP_perfmon, cmd, arg, count);
 }
 
+static inline int
+xencomm_arch_hypercall_fpswa_revision(struct xencomm_handle *arg)
+{
+       return _hypercall2(int, ia64_dom0vp_op,
+                          IA64_DOM0VP_fpswa_revision, arg);
+}
+
 // for balloon driver
 #define HYPERVISOR_update_va_mapping(va, new_val, flags) (0)
 
@@ -397,6 +404,7 @@ xencomm_arch_hypercall_perfmon_op(unsigned long cmd,
 #define HYPERVISOR_memory_op xencomm_mini_hypercall_memory_op
 #define HYPERVISOR_xenoprof_op xencomm_mini_hypercall_xenoprof_op
 #define HYPERVISOR_perfmon_op xencomm_mini_hypercall_perfmon_op
+#define HYPERVISOR_fpswa_revision xencomm_mini_hypercall_fpswa_revision
 #else
 #define HYPERVISOR_sched_op xencomm_hypercall_sched_op
 #define HYPERVISOR_event_channel_op xencomm_hypercall_event_channel_op
@@ -408,6 +416,7 @@ xencomm_arch_hypercall_perfmon_op(unsigned long cmd,
 #define HYPERVISOR_memory_op xencomm_hypercall_memory_op
 #define HYPERVISOR_xenoprof_op xencomm_hypercall_xenoprof_op
 #define HYPERVISOR_perfmon_op xencomm_hypercall_perfmon_op
+#define HYPERVISOR_fpswa_revision xencomm_hypercall_fpswa_revision
 #endif
 
 #define HYPERVISOR_suspend xencomm_hypercall_suspend
index 704876fb584f9c2fbc3e93c700349b1ca5670c7e..a48969cf593566be295b5a5e2461cb1529e84f1b 100644 (file)
@@ -352,6 +352,16 @@ dom0vp_ioremap(struct domain *d, unsigned long mpaddr, unsigned long size)
                                    ASSIGN_writable | ASSIGN_nocache);
 }
 
+static unsigned long
+dom0vp_fpswa_revision(XEN_GUEST_HANDLE(uint) revision)
+{
+    if (fpswa_interface == NULL)
+        return -ENOSYS;
+    if (copy_to_guest(revision, &fpswa_interface->revision, 1))
+        return -EFAULT;
+    return 0;
+}
+
 unsigned long
 do_dom0vp_op(unsigned long cmd,
              unsigned long arg0, unsigned long arg1, unsigned long arg2,
@@ -402,6 +412,12 @@ do_dom0vp_op(unsigned long cmd,
         ret = do_perfmon_op(arg0, hnd, arg2);
         break;
     }
+    case IA64_DOM0VP_fpswa_revision: {
+        XEN_GUEST_HANDLE(uint) hnd;
+        set_xen_guest_handle(hnd, (uint*)arg0);
+        ret = dom0vp_fpswa_revision(hnd);
+        break;
+    }
     default:
         ret = -1;
                printk("unknown dom0_vp_op 0x%lx\n", cmd);
index ac0bae0a7b3ce5c91887e030a5e4ff709d043f03..390d74f12ff15819910677310789e07ef6e54c29 100644 (file)
@@ -504,6 +504,9 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
 /* gmfn version of IA64_DOM0VP_add_physmap */
 #define IA64_DOM0VP_add_physmap_with_gmfn       9
 
+/* get fpswa revision */
+#define IA64_DOM0VP_fpswa_revision      10
+
 // flags for page assignement to pseudo physical address space
 #define _ASSIGN_readonly                0
 #define ASSIGN_readonly                 (1UL << _ASSIGN_readonly)